require('dotenv').config();
const { pool } = require('./config/db');

// 测试数据库连接
async function testConnection() {
  let connection;
  try {
    connection = await pool.promise().getConnection();
    console.log('数据库连接成功！');
    
    // 执行简单查询
    const [rows] = await connection.execute('SELECT 1 + 1 AS solution');
    console.log('查询结果:', rows[0]);
    
    connection.release();
  } catch (error) {
    console.error('数据库连接失败:', error);
  }
}

testConnection();